package com.wedo.mall.dialog;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.e.library.dialog.EPopup;
import com.wedo.mall.R;

import butterknife.BindString;
import butterknife.OnClick;

/**
 * 选择区域编码（需求不明确，UI没有，暂写死）
 * Created by e on 2017/9/18.
 */

public class RegionalPopup extends EPopup {

    @BindString(R.string.register_region_format) String register_region_format;

    public RegionalPopup(Context context) {
        super(context);
    }

    @Override
    protected int layout() {
        return R.layout.popup_regional;
    }

    @Override
    protected void onPopupCreated(Context context) {

    }

    @Override
    public void showPopup(View parent) {
    }

    private TextView tv;
    public void show(TextView tv){
        this.tv = tv;
        showAsDropDown(tv);
    }

    @OnClick(R.id.tv_region_china)
    protected void onChinaClick(){
        tv.setTag("86");
        tv.setText(String.format(register_region_format,"86"));
        dismiss();
    }

    @OnClick(R.id.tv_region_malaysia)
    protected void onMalaysiaClick(){
        tv.setTag("60");
        tv.setText(String.format(register_region_format,"60"));
        dismiss();
    }
}
